feat: auto-resume polish + spawn-gate follow-ups — persistent crash trace, circuit breaker, cancel, Retry-After (katas znhn, bccd) - #582
Merged
Conversation
…ollowups) Validation wave results (7 verified, 6 falsified, 2 accepted-deferred): - D-7 REVERSED: do not gate the opencode cold-start (A10: worst-case permit hold ~50-70s vs 10s door waits; singleton already bounds forks) - D-3/Task 9: reconnect backstop clears stale recovering notices (A3: missed broadcast frames were a forever-lying notice) - D-4/Task 8: registry-validate cancel ids; take_cancel emits the settle frame (A5: poisoned-flag path defused) - D-1/Task 9: corrected clean-exit rationale; allowlist pinned as the out-of-order barrier (A1/A6) - Task 7: thread cfg.healthy_lifetime_ms into the eviction condition; between-thresholds test (A8) - Tasks 9/10: clear settle state on exit/replacement (A15 stale resumeCycles leak) - Notes: Task 3 byte-identical payload (A9), Task 12 knob margins (A7), D-2 createRequestId verification record (A2)
Fresh-eyes review iteration 1 flagged two executable plan defects:
- Task 10: setPaneCrashTrace/clearPaneCrashTrace were specified against a
paneId-only helper call, but the panes-tree traversal helpers take
positional (state, tabId, paneId). Payloads now carry { tabId, paneId },
the reducer bodies call findReconcileTerminalContent(state,
action.payload.tabId, action.payload.paneId), and both TerminalView
dispatch sites (terminal.replaced handler, banner onDismissCrashTrace)
pass tabId. Also corrected the 'same traversal helper' claim: the
reconcile-notice reducers use findReconcilePaneContent (:631); crashTrace
uses its TerminalPaneContent-narrowed sibling findReconcileTerminalContent
(:618).
- Task 9: the D-3 reconnect-backstop test referenced reconnectHandler!(),
which the existing harness never captures (wsMocks.onReconnect is a bare
mockReturnValue). Added an explicit harness-extension step: declare
reconnectHandler next to messageHandler and capture it in beforeEach via
wsMocks.onReconnect.mockImplementation, mirroring the messageHandler
capture.
…art (znhn#4, bccd#3) 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <[email protected]>
…e (bccd#1, bccd#5) 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <[email protected]>
… (bccd#2) 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <[email protected]>
…doors (bccd#4, D-7 reversed) 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <[email protected]>
…ld (znhn#3) 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <[email protected]>
🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <[email protected]>
🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <[email protected]>
…-flight resume (znhn#2) 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <[email protected]>
…add cancel (znhn#2,#3,#6) 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <[email protected]>
…n#1) Note: the plan's no-code-change persistence premise held for the persistMiddleware strip (denylist) and persistedState load (passthrough), but normalizePaneContent is a whitelist reachable from hydratePanes — the trace needed an explicit passthrough there to actually survive reload. 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <[email protected]>
…znhn#2) 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <[email protected]>
… immediately (znhn#1,#2,#3) 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <[email protected]>
…sh-eyes) A fresh create is a genuinely NEW identity-less conversation — the persisted 'crashed & auto-resumed' trace belongs to the retired session and must not leak onto it. The respawn branch deliberately keeps it (same conversation). 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <[email protected]>
…replaced tail (znhn#2 fresh-eyes) A cancel landing after the hub's post-sleep take_cancel check (or for a terminal that settles without ever reaching the Resume arm) leaked in WsState.auto_resume_cancels forever. Every settle tail and the respawn match tail now consume the entry, so 'removed on consumption' holds on every path. Too late to abort at those points — cleanup, not abort. 🤖 Generated with [Amplifier](https://github.com/microsoft/amplifier) Co-Authored-By: Amplifier <[email protected]>
This was referenced Jul 30, 2026
pull Bot
pushed a commit
to HinchK/freshell
that referenced
this pull request
Jul 31, 2026
…piro#582) Post-merge code-review pass authored 2026-07-29/30 by three misdirected code-review skill forks; content audited and adopted deliberately: - dedupe env parsers into crate::env_parse (freshell-ws) - extract fail_json_code_retry_after; use in spawn_gate_error_response - single broadcast_frame/broadcast_settled_frame home + SETTLE_REASON_CANCELLED - fix two real leaks: auto-resume attempts map growth on terminal exit, stranded auto_resume_cancels entries (+ stale-entry sweep) - move CrashTrace to shared/session-contract.ts as zod schema with sanitizeRestoreError/sanitizeCrashTrace helpers; consume in client stores - make recordAutoResumeSettled redelivery-idempotent without materializing missing entries; tests updated Verified: cargo check clean (3434 files), client tsc clean, 232 client tests passing; authoring forks additionally verified fmt/clippy clean, 330 Rust lib tests, 183 client tests. Generated with Amplifier Co-Authored-By: Amplifier <[email protected]>
pull Bot
pushed a commit
to HinchK/freshell
that referenced
this pull request
Jul 31, 2026
…erminal identity (danshapiro#584), deck visual tweaks (danshapiro#585) Conflict resolution (crates/freshell-freshagent/src/terminal_tabs.rs, settle_gated_create): kept BOTH sides, ordered spawn-gate acquire (D-C-R, ours) BEFORE the PIN2 claude prespawn durable binding (theirs) — a gate rejection must not leave a stale prespawn ledger row, so the durable write happens only after a permit is secured. Post-merge semantic fix: pinned FRESHELL_CODEX_MANAGED_LAUNCH=0 in rest_locator_identity.rs::rest_created_codex_pane_binds_identity_row_and_ledger (new in danshapiro#584, written pre-flip; exercises the plain-CLI codex path with a sleeper fake that cannot serve an app-server sidecar). Pre-merge analysis recorded no redundancy between the danshapiro#582 review-hardening (d9705fd) and the remote delta; danshapiro#586 touches resume-resolve-contract.ts, not session-contract.ts — CrashTrace work composes cleanly. Generated with Amplifier Co-Authored-By: Amplifier <[email protected]>
pull Bot
pushed a commit
to HinchK/freshell
that referenced
this pull request
Jul 31, 2026
…launch, danshapiro#582 breaker, danshapiro#584 identity) Fold main's post-fork struct/initializer fields (auto_resume_cancels, resume_cycles, HubConfig/CrashContext breaker fields) into branch-added harnesses and literals after replaying onto origin/main.
pull Bot
pushed a commit
to HinchK/freshell
that referenced
this pull request
Jul 31, 2026
…keeping single-counted One Recovering frame per gate-fired respawn, no synthetic breaker settle, auto_resume_cancels untouched. The gate reduces breaker trips (kills missing-session flap at the source) without masquerading as one.
pull Bot
pushed a commit
to HinchK/freshell
that referenced
this pull request
Jul 31, 2026
Records the gate-before-plan ordering at all three doors and the PIN 2 prealloc threading; verifies no stale 'default OFF' comments and no client double-messaging between the created-notice and danshapiro#582 banners.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implements the two council follow-up katas znhn + bccd (crash-resilience and spawn-gate polish from the PR #560/#559 reviews).
znhn (auto-resume polish): persistent "crashed (exit N) & auto-resumed at HH:MM" trace on the pane — survives reload (persisted pane state with an explicit whitelist passthrough, pinned round-trip), stays until dismissed, and is cleared when a pane becomes a genuinely new conversation (reconcile-fresh path — review finding, fixed red-first); flap-loop circuit breaker with rolling-window escalation and a "crashed N times — paused" banner (server-side state, reload cannot bypass); NEW terminal.autoResumeCancel protocol message with a cancel button on the recovering notice (registry-validated, spoof-proof, cleanup-on-every-tail pinned); settle frames on EVERY silent settle path so the "auto-resuming" notice clears immediately — the client 30s TTL guessing apparatus deleted, replaced by a reconnect backstop; SpawnGate::acquire_uncancellable API migrating both dummy-cancel callers; honest Relaunch copy ("resumes this conversation").
bccd (spawn-gate polish): Retry-After header on the REST 429; deterministic burst pin (exact queued_total==16 + zero-completions-while-held, replacing the probabilistic threshold); opencode sidecar cold-start deliberately NOT gated (decision reversed with load-bearing arithmetic recorded at both doors: 50–70s permit holds would starve the k-permit budget; single-flight already bounds forks); grep-able D-C-REVISIT tripwire markers.
Protocol: inventory 29→30 client / 87 total, RuntimeStatus::Exited + resumeCycles fields; both pins (TS freeze + Rust inventory/schema) updated same-commit; regen verified idempotent (zero diff); Node server accepts-and-ignores the new message for wire compat.
Verification: cargo workspace green, coordinated npm green, test:port 38/38, lint 0 errors, e2e 23/23 incl. the full restore-contract-wall at zero pins; delta review PASSED round 1; its two recommendations (crashTrace cleared on reconcile-fresh; auto_resume_cancels drained on every tail) applied red-first (5a5b0ad, 9a76924).